package cn.lyjuan.android.demofive.ui.tab.tabhost;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Window;
import android.widget.TabHost;
import cn.lyjuan.android.demofive.R;

/**
 * Created by chad on 2016/2/20.
 */
public class TabHostActivity extends TabActivity
{
    private TabHost tabhost;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        // 不显示标题栏
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);

        super.onCreate(savedInstanceState);

        this.setContentView(R.layout.ui_tabhost);

        Resources rs = this.getResources();

        tabhost = this.getTabHost();
        TabHost.TabSpec spec = null;
        Intent intent = null;

        // First
        intent = new Intent(this, FirstTabActivity.class);
        spec = tabhost.newTabSpec("First").setIndicator("First", rs.getDrawable(R.drawable.ui_tabhost_first)).setContent(intent);
        tabhost.addTab(spec);

        // Second
        intent = new Intent(this, SecondTabActivity.class);
        spec = tabhost.newTabSpec("Second").setIndicator("Second", rs.getDrawable(R.drawable.ui_tabhost_second)).setContent(intent);
        tabhost.addTab(spec);
    }
}
